package com.imay.live.adapter;

import android.support.annotation.Nullable;
import android.view.View;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.imay.live.R;
import com.imay.live.helper.LevelHelper;
import com.imay.live.logic.ChatTimeLogic;
import com.imay.live.model.CallLiveListModel;
import com.imay.live.utils.GlideUtil;

import java.util.List;

/**
 * Created by nick on 2017/8/24.
 *
 */

public class CallLiveAdapter extends BaseQuickAdapter<CallLiveListModel,BaseViewHolder> {

    public CallLiveAdapter(@Nullable List data) {
        super(R.layout.item_call_live,data);
    }

    @Override
    protected void convert(BaseViewHolder helper, CallLiveListModel item) {
        ImageView iv_head_img_system_notice = helper.getView(R.id.iv_head_img_recent_contact);
        iv_head_img_system_notice.setVisibility(View.VISIBLE);
        GlideUtil.loadCircleImage(iv_head_img_system_notice, item.getImgHead(), R.mipmap.pnl_00_head108);
        helper.setText(R.id.tv_name_recent_contact, item.getNick());
        helper.setText(R.id.tv_content_recent_contact, item.getMessage());
        helper.setText(R.id.tv_time_recent_contact, ChatTimeLogic.getMessageTime(item.getCreateAt()));
        helper.setVisible(R.id.tv_user_level_recent_contact, true);
        helper.setText(R.id.tv_user_level_recent_contact, item.getUserLevel() + "");
        helper.setBackgroundRes(R.id.tv_user_level_recent_contact, LevelHelper.getUserLevelResId(item.getUserLevel() ));
        helper.setImageResource(R.id.iv_vip, LevelHelper.getVIPIcon(item.getVip()));
    }


}
